﻿using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace Himp.Platform.Migrations
{
    /// <inheritdoc />
    public partial class modify_menu_v2 : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropColumn(
                name: "MenuCatgeCode",
                table: "MainMenu");

            migrationBuilder.DropColumn(
                name: "MenuCatgeName",
                table: "MainMenu");

            migrationBuilder.RenameColumn(
                name: "MenuCode",
                table: "MainMenu",
                newName: "MenuCodg");

            migrationBuilder.RenameIndex(
                name: "IX_MainMenu_MenuCode",
                table: "MainMenu",
                newName: "IX_MainMenu_MenuCodg");

            migrationBuilder.AlterColumn<string>(
                name: "Link",
                table: "MainMenu",
                type: "character varying(200)",
                maxLength: 200,
                nullable: true,
                oldClrType: typeof(string),
                oldType: "character varying(256)",
                oldMaxLength: 256,
                oldNullable: true);

            migrationBuilder.AlterColumn<string>(
                name: "I18n",
                table: "MainMenu",
                type: "character varying(50)",
                maxLength: 50,
                nullable: true,
                oldClrType: typeof(string),
                oldType: "character varying(48)",
                oldMaxLength: 48,
                oldNullable: true);

            migrationBuilder.AddColumn<DateTime>(
                name: "CreationTime",
                table: "MainMenu",
                type: "timestamp with time zone",
                nullable: false,
                defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));

            migrationBuilder.AddColumn<Guid>(
                name: "CreatorId",
                table: "MainMenu",
                type: "uuid",
                nullable: true);

            migrationBuilder.AddColumn<string>(
                name: "ExternalLink",
                table: "MainMenu",
                type: "character varying(200)",
                maxLength: 200,
                nullable: true);

            migrationBuilder.AddColumn<bool>(
                name: "HideFlag",
                table: "MainMenu",
                type: "boolean",
                nullable: false,
                defaultValue: false);

            migrationBuilder.AddColumn<DateTime>(
                name: "LastModificationTime",
                table: "MainMenu",
                type: "timestamp with time zone",
                nullable: true);

            migrationBuilder.AddColumn<Guid>(
                name: "LastModifierId",
                table: "MainMenu",
                type: "uuid",
                nullable: true);

            migrationBuilder.AddColumn<int>(
                name: "MenuType",
                table: "MainMenu",
                type: "integer",
                nullable: false,
                defaultValue: 0);

            migrationBuilder.AddColumn<bool>(
                name: "OpenFlag",
                table: "MainMenu",
                type: "boolean",
                nullable: false,
                defaultValue: false);

            migrationBuilder.AddColumn<bool>(
                name: "ReuseFlag",
                table: "MainMenu",
                type: "boolean",
                nullable: false,
                defaultValue: false);

            migrationBuilder.AddColumn<bool>(
                name: "ShortcutFlag",
                table: "MainMenu",
                type: "boolean",
                nullable: false,
                defaultValue: false);

            migrationBuilder.AddColumn<string>(
                name: "Target",
                table: "MainMenu",
                type: "character varying(256)",
                maxLength: 256,
                nullable: true);

            migrationBuilder.AddColumn<bool>(
                name: "ValiFalg",
                table: "MainMenu",
                type: "boolean",
                nullable: false,
                defaultValue: false);
        }

        /// <inheritdoc />
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropColumn(
                name: "CreationTime",
                table: "MainMenu");

            migrationBuilder.DropColumn(
                name: "CreatorId",
                table: "MainMenu");

            migrationBuilder.DropColumn(
                name: "ExternalLink",
                table: "MainMenu");

            migrationBuilder.DropColumn(
                name: "HideFlag",
                table: "MainMenu");

            migrationBuilder.DropColumn(
                name: "LastModificationTime",
                table: "MainMenu");

            migrationBuilder.DropColumn(
                name: "LastModifierId",
                table: "MainMenu");

            migrationBuilder.DropColumn(
                name: "MenuType",
                table: "MainMenu");

            migrationBuilder.DropColumn(
                name: "OpenFlag",
                table: "MainMenu");

            migrationBuilder.DropColumn(
                name: "ReuseFlag",
                table: "MainMenu");

            migrationBuilder.DropColumn(
                name: "ShortcutFlag",
                table: "MainMenu");

            migrationBuilder.DropColumn(
                name: "Target",
                table: "MainMenu");

            migrationBuilder.DropColumn(
                name: "ValiFalg",
                table: "MainMenu");

            migrationBuilder.RenameColumn(
                name: "MenuCodg",
                table: "MainMenu",
                newName: "MenuCode");

            migrationBuilder.RenameIndex(
                name: "IX_MainMenu_MenuCodg",
                table: "MainMenu",
                newName: "IX_MainMenu_MenuCode");

            migrationBuilder.AlterColumn<string>(
                name: "Link",
                table: "MainMenu",
                type: "character varying(256)",
                maxLength: 256,
                nullable: true,
                oldClrType: typeof(string),
                oldType: "character varying(200)",
                oldMaxLength: 200,
                oldNullable: true);

            migrationBuilder.AlterColumn<string>(
                name: "I18n",
                table: "MainMenu",
                type: "character varying(48)",
                maxLength: 48,
                nullable: true,
                oldClrType: typeof(string),
                oldType: "character varying(50)",
                oldMaxLength: 50,
                oldNullable: true);

            migrationBuilder.AddColumn<string>(
                name: "MenuCatgeCode",
                table: "MainMenu",
                type: "character varying(50)",
                maxLength: 50,
                nullable: false,
                defaultValue: "");

            migrationBuilder.AddColumn<string>(
                name: "MenuCatgeName",
                table: "MainMenu",
                type: "character varying(100)",
                maxLength: 100,
                nullable: false,
                defaultValue: "");
        }
    }
}
